package com.ztstkj.lzservices.retrofits

import com.ztstkj.lzservices.dto.ApkOutput
import com.ztstkj.lzservices.dto.CardQrcodeOutput
import com.ztstkj.lzservices.dto.DeliveryInput
import com.ztstkj.lzservices.dto.DeliveryOutput
import com.ztstkj.lzservices.dto.EquipmentOutput
import com.ztstkj.lzservices.dto.HeartInput
import com.ztstkj.lzservices.dto.HeartOutput
import com.ztstkj.lzservices.dto.LogInput
import com.ztstkj.lzservices.dto.RecycleOrderInput
import com.ztstkj.lzservices.dto.RecyleItem
import com.ztstkj.lzservices.dto.TodaySummaryOutput
import com.ztstkj.lzservices.dto.UserOutput
import com.ztstkj.lzservices.dto.boards.BoardOutput
import okhttp3.ResponseBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query
import retrofit2.http.Streaming
import retrofit2.http.Url

interface IApi {
    @GET("/api/equipment/detail/{equipmentRealNo}")
    suspend fun getEquipment(@Path("equipmentRealNo") equipmentRealNo: String): ResponseResult<EquipmentOutput?>

    @GET("/api/user/getUser2/{cardNo}")
    suspend fun getUser(@Path("cardNo") cardNo: String): ResponseResult<UserOutput?>

    @GET("/api/user/getUserForApp")
    suspend fun getUserForApp(@Query("cpuNo") cpuNo: String, @Query("cardNo") cardNo: String): ResponseResult<UserOutput?>

    @GET("/api/delivery/todayDelivery/{equipmentRealNo}")
    suspend fun getTodayDelivery(@Path("equipmentRealNo") equipmentRealNo: String): ResponseResult<TodaySummaryOutput?>

    @POST("/api/delivery")
    suspend fun postDelivery(@Body deliveryInput: DeliveryInput): ResponseResult<DeliveryOutput>

    @POST("/api/equipment/heart")
    suspend fun postHeart(@Body heartInput: HeartInput): ResponseResult<HeartOutput>

    @POST("/api/log/write")
    suspend fun postLog(@Body logs: List<LogInput>): ResponseResult<Boolean>

    @GET("/api/user/cardQrcodeCount")
    suspend fun getCardQrcodeCount(@Query("deptId") deptId: Int): ResponseResult<Int>

    @GET("/api/user/cardQrcodeList")
    suspend fun getCardQrcodeList(@Query("deptId") deptId: Int): ResponseResult<List<CardQrcodeOutput>>

    @POST("/api/equipment/board")
    suspend fun postBoard(@Query("deptId") deptId: Int): ResponseResult<BoardOutput>

    @GET("/api/equipment/reycles")
    suspend fun getRecyles(): ResponseResult<List<RecyleItem>>

    @GET("/api/apk/latest/{equipmentRealNo}/{apkType}")
    suspend fun getLatestApk(@Path("equipmentRealNo") equipmentRealNo: String,@Path("apkType") apkType: Int): ResponseResult<ApkOutput>

    @POST("/api/recyleorder/create")
    suspend fun postCreateOrder(@Body input: RecycleOrderInput): ResponseResult<Int>

    @Streaming
    @GET
    suspend fun downloadFile(@Url fileUrl: String?): ResponseBody


}